package com.www.applyword.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.www.applyword.R;

import java.util.List;

public class GirdDropDownAdpter5 extends BaseAdapter {
    private Context context;
    private List<String> beanList;
    private LayoutInflater inflater;



    public GirdDropDownAdpter5(Context context, List<String> beanList) {
        this.context = context;
        this.beanList = beanList;
        inflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return beanList.size();
    }

    @Override
    public Object getItem(int position) {
        return beanList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if(convertView == null){
            holder = new ViewHolder();
            convertView = inflater.inflate(R.layout.item_job_work4,null);
            holder.tv_work = convertView.findViewById(R.id.tv_work);

            convertView.setTag(holder);
        }else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.tv_work.setText(beanList.get(position));
        return convertView;
    }

    class ViewHolder {
        private TextView tv_work;
    }
}
